<?php
/**
 *
 * @author: xaboy<365615158@qq.com>
 * @day: 2017/12/11
 */

namespace app\index\controller;



use basic\WapBasic;
use service\UtilService;
use think\Cookie;
use think\Route;
use think\Session;
use think\Url;
use app\index\model\user\User;
use service\JsonService;

class AuthController extends WapBasic
{
    /**
     * 用户ID
     * @var int
     */
    protected $uid;

    /**
     * 用户信息
     * @var
     */
    protected $userInfo;

    protected function _initialize()
    {
        parent::_initialize();
    }

    public function Login(){
        $this->uid = Session::get('uid');
        if($this->uid){
            $this->userInfo = User::getUserInfo($this->uid);
            if(!$this->userInfo || !isset($this->userInfo['uid']))  return WapBasic::failed('读取用户信息失败',Url::build('login/login'));
            if(!$this->userInfo['status'])  return WapBasic::failed('已被禁止登陆',Url::build('login/login'));
        }else{
            return WapBasic::failed('请先登录',Url::build('login/login'));
        }
    }

}